<style>
	.btn.btn-success {
		background: #6499fa;
	}
</style>
<div class='fui-page fui-page-current'>
    <div class="fui-header">
		<div class="fui-header-left">
			<a class="back" ng-click="goback()"></a>
		</div>
		<div class="title">绑卡</div> 
		<div class="fui-header-right">&nbsp;</div>
    </div>
    <div class="fui-content">
		<div class="c" style="background:#6499fa;padding-bottom:1rem;border-bottom-right-radius:5rem;border-bottom-left-radius:5rem;">
			<div class="c">
				<img style="width:60%" ng-src="{{tomedia(pagedata.item.backimage) || '../addons/jy_allinpay/image/renz.png'}}" />
			</div>
			<div class="c" style="margin-top:-1rem;font-size:0.7rem">
				<p class="c" style="color:#fff">{{pagedata.account.title}}承诺身份信息仅限购物流程使用，</p>
				<p class="c" style="color:#fff">不会向任何人泄露用户个人信息。</p>
			</div>
		</div>
		<div style="padding:0.5rem">
		<div class="tips tips-yellow" style="margin:0">
			<i class="fa fa-bullhorn"></i> [<red>温馨提示</red>]：{{pagedata.tips}}
		</div>
		<div class='fui-cell-group' ng-if="!pagedata.item.id || pagedata.item.upcan">
			<div class="fui-cell">
                <div class="fui-cell-label">真实姓名</div>
                <div class="fui-cell-info"><input type="text" class="fui-input" placeholder="真实姓名" ng-model="pagedata.item.realname"/></div>
            </div>
			<div class="fui-cell">
                <div class="fui-cell-label">身份证号码</div>
                <div class="fui-cell-info"><input type="text" class="fui-input" placeholder="身份证号码" ng-model="pagedata.item.cardnum"/></div>
            </div>
			<div class="fui-cell">
                <div class="fui-cell-label">手机号</div>
                <div class="fui-cell-info"><input type="text" class="fui-input" placeholder="手机号" ng-model="pagedata.item.mobile"/></div>
            </div>
			<div class="fui-cell">
                <div class="fui-cell-label">银行卡号</div>
                <div class="fui-cell-info"><input type="text" class="fui-input" placeholder="银行卡号" ng-model="pagedata.item.acctno"/></div>
            </div>
			<div ng-if="pagedata.item.thpinfo" class="fui-cell">
                <div class="fui-cell-label">短信验证码</div>
                <div class="fui-cell-info"><input type="text" class="fui-input" placeholder="短信验证码" ng-model="pagedata.item.smscode"/></div>
				<div class="fui-cell-remark noremark"><a class="btn btn-default btn-default-o btn-sm" ng-click="pagedata.getsmspost()" id="sms_code">重新获取验证码</a></div>
            </div>
		</div>
		<div class='fui-cell-group' ng-if="pagedata.item.id && !pagedata.item.upcan">
			<div class="fui-cell">
                <div class="fui-cell-label">真实姓名</div>
                <div class="fui-cell-info">{{pagedata.item.realname}}</div>
            </div>
			<div class="fui-cell">
                <div class="fui-cell-label">身份证号码</div>
                <div class="fui-cell-info">{{pagedata.item.cardnum}}</div>
            </div>
		</div>
		</div>
		<a ng-if="(!pagedata.item.id || pagedata.item.upcan) && !pagedata.item.thpinfo" href="javascript:;" class='btn btn-success block' style="line-height: 2.6;" ng-click="pagedata.post()">绑卡申请</a>
		<a ng-if="(!pagedata.item.id || pagedata.item.upcan) && pagedata.item.thpinfo" href="javascript:;" class='btn btn-success block' style="line-height: 2.6;" ng-click="pagedata.checkpost()">绑卡确认</a>
		<a ng-if="pagedata.item.passed==1" href="javascript:;" class='btn btn-gray block' style="line-height: 2.6;">您已完成绑卡</a>
		<a ng-if="pagedata.item.id>0 && pagedata.item.passed!=1 && !pagedata.item.upcan" href="javascript:;" class='btn btn-success block' style="line-height: 2.6;" ng-click="pagedata.item.upcan=true">绑卡失败（重新提交）</a>
	</div>
</div>
<script>
scope.pagedata.post=function(){
	scope.post_json('jy_allinpay/index/post/',scope.pagedata.item,function(res){
		console.log(res);
		if(res.thpinfo){
			scope.pagedata.item.thpinfo=res.thpinfo;
			scope.$evalAsync();
		}
	});
}
scope.pagedata.getsmspost=function(){
	scope.post_json('jy_allinpay/index/getsmspost/',scope.pagedata.item,function(res){
		console.log(res);
		if(res.thpinfo){
			scope.pagedata.item.thpinfo=res.thpinfo;
			scope.$evalAsync();
		}
	});
}
scope.pagedata.checkpost=function(){
	scope.post_json('jy_allinpay/index/checkpost/',scope.pagedata.item,function(res){
		console.log(res);
		if(res.thpinfo){
			scope.pagedata.item.thpinfo=res.thpinfo;
			scope.$evalAsync();
		}
	});
}
</script>